import 'dart:convert' show json;

class User {

  int id;
  String iUserId;
  String name;
  String sSessionKey;
  User.empty();
  User.fromParams({this.id, this.iUserId, this.name, this.sSessionKey});

  factory User(jsonStr) => jsonStr == null ? null : jsonStr is String ? new User.fromJson(json.decode(jsonStr)) : new User.fromJson(jsonStr);

  User.fromJson(jsonRes) {
    iUserId = jsonRes['iUserId'];
    name = jsonRes['name'];
    sSessionKey = jsonRes['sSessionKey'];
    id = jsonRes['id'];
  }

  @override
  String toString() {
    return '{"id": $id,"iUserId": ${iUserId != null?'${json.encode(iUserId)}':'null'},"name": ${name != null?'${json.encode(name)}':'null'},"sSessionKey": ${sSessionKey != null?'${json.encode(sSessionKey)}':'null'}}';
  }
}

